<template />

<script>
export default {
  data() {
    return {}
  },
  created() {
    const {
      title = '提示',
      message = '此操作将永久删除该数据, 是否继续?',
      type = 'warning',
      showCancelButton = true,
      showConfirmButton = true,
      customClass = 'conform-dialog',
      showClose = true,
      closeOnPressEscape = true,
      lockScroll = true,
      closeOnClickModal = false,
      confirmButtonText = '确定',
      cancelButtonText = '取消',
      confirm = () => {},
      cancel = () => {}
    } = this.params
    this.$confirm(message, title, {
      type,
      showCancelButton,
      showConfirmButton,
      customClass,
      showClose,
      cancelButtonClass: 'btn-custom-cancel',
      closeOnPressEscape,
      lockScroll,
      closeOnClickModal,
      confirmButtonText,
      cancelButtonText
    })
      .then(() => {
        confirm()
      })
      .catch(() => {
        cancel()
      })
  }
}
</script>

<style>
/* 设置取消按钮向右浮动，左magin为10px，即与确定按钮间距为10px */
.conform-dialog .btn-custom-cancel {
  float: right;
  margin-left: 10px;
}
</style>
